package com.movisol.messengerprofileservice.data;

import java.io.Serializable;
import java.util.Date;

@SuppressWarnings("serial")
public class UserProfile implements Serializable{
	
	private String Nickname = null;
	private String CountryId = null;
	private String LanguageId = null;
	private String UserId = null;
	private String Email = null;
	private Boolean EmailVerified = null;
	private String Firstname = null;
	private String Lastname = null;
	private Date Birthdate = null;
	private Integer Gender = null;
	private String PictureUrl = null;
	private String PictureRaw = null;
	private String DeviceToken = null;
	private String Signature = null;
	
	public UserProfile()
	{
		super();
	}
	
	
	public UserProfile(String nickName, String countryId, String languageId,
			String userId, String email, Boolean emailVerified,
			String firstName, String lastName, Date birtdate, Integer gender,
			String pictureUrl, String pictureRaw, String deviceToken,
			String signature) {
		super();
		this.Nickname = nickName;
		this.CountryId = countryId;
		this.LanguageId = languageId;
		this.UserId = userId;
		this.Email = email;
		this.EmailVerified = emailVerified;
		this.Firstname = firstName;
		this.Lastname = lastName;
		this.Birthdate = birtdate;
		this.Gender = gender;
		this.PictureUrl = pictureUrl;
		this.PictureRaw = pictureRaw;
		this.DeviceToken = deviceToken;
		this.Signature = signature;
	}


	public String getCalculatedNickName() {
		if(Nickname != null && !Nickname.trim().equals(""))
		{
			return Nickname.length() > 20 ? Nickname.substring(0, 20).concat("...") : Nickname;
		}
		else
		{
			String subEmail = Email.substring(0, Email.indexOf("@")); 
			return subEmail.length() > 20 ? subEmail.substring(0, 20).concat("...") : subEmail;
		}
	}
	
	public String getNickName()
	{
		return Nickname;
	}


	public void setNickName(String nickName) {
		this.Nickname = nickName;
	}


	public String getCountryId() {
		return CountryId;
	}


	public void setCountryId(String countryId) {
		this.CountryId = countryId;
	}


	public String getLanguageId() {
		return LanguageId;
	}


	public void setLanguageId(String languageId) {
		this.LanguageId = languageId;
	}


	public String getUserId() {
		return UserId;
	}


	public void setUserId(String userId) {
		this.UserId = userId;
	}


	public String getEmail() {
		return Email;
	}


	public void setEmail(String email) {
		this.Email = email;
	}


	public Boolean isEmailVerified() {
		return EmailVerified;
	}


	public void setEmailVerified(Boolean emailVerified) {
		this.EmailVerified = emailVerified;
	}


	public String getFirstName() {
		return Firstname;
	}


	public void setFirstName(String firstName) {
		this.Firstname = firstName;
	}


	public String getLastName() {
		return Lastname;
	}


	public void setLastName(String lastName) {
		this.Lastname = lastName;
	}


	public Date getBirthdate() {
		return Birthdate;
	}


	public void setBirthdate(Date birthdate) {
		this.Birthdate = birthdate;
	}


	public Integer getGender() {
		return Gender;
	}


	public void setGender(Integer gender) {
		this.Gender = gender;
	}


	public String getPictureUrl() {
		return PictureUrl;
	}


	public void setPictureUrl(String pictureUrl) {
		this.PictureUrl = pictureUrl;
	}


	public String getPictureRaw() {
		return PictureRaw;
	}


	public void setPictureRaw(String pictureRaw) {
		this.PictureRaw = pictureRaw;
	}


	public String getDeviceToken() {
		return DeviceToken;
	}


	public void setDeviceToken(String deviceToken) {
		this.DeviceToken = deviceToken;
	}


	public String getSignature() {
		return Signature;
	}


	public void setSignature(String signature) {
		this.Signature = signature;
	}


	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "UserProfile [Nickname=" + Nickname + ", CountryId=" + CountryId + ", LanguageId=" + LanguageId
				+ ", UserId=" + UserId + ", Email=" + Email + ", EmailVerified=" + EmailVerified + ", Firstname="
				+ Firstname + ", Lastname=" + Lastname + ", Birthdate=" + Birthdate + ", Gender=" + Gender
				+ ", PictureUrl=" + PictureUrl + ", PictureRaw=" + PictureRaw + ", DeviceToken=" + DeviceToken
				+ ", Signature=" + Signature + "]";
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((Birthdate == null) ? 0 : Birthdate.hashCode());
		result = prime * result + ((CountryId == null) ? 0 : CountryId.hashCode());
		result = prime * result + ((DeviceToken == null) ? 0 : DeviceToken.hashCode());
		result = prime * result + ((Email == null) ? 0 : Email.hashCode());
		result = prime * result + ((EmailVerified == null) ? 0 : EmailVerified.hashCode());
		result = prime * result + ((Firstname == null) ? 0 : Firstname.hashCode());
		result = prime * result + ((Gender == null) ? 0 : Gender.hashCode());
		result = prime * result + ((LanguageId == null) ? 0 : LanguageId.hashCode());
		result = prime * result + ((Lastname == null) ? 0 : Lastname.hashCode());
		result = prime * result + ((Nickname == null) ? 0 : Nickname.hashCode());
		result = prime * result + ((PictureRaw == null) ? 0 : PictureRaw.hashCode());
		result = prime * result + ((PictureUrl == null) ? 0 : PictureUrl.hashCode());
		result = prime * result + ((Signature == null) ? 0 : Signature.hashCode());
		result = prime * result + ((UserId == null) ? 0 : UserId.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserProfile other = (UserProfile) obj;
		if (Birthdate == null)
		{
			if (other.Birthdate != null)
				return false;
		} else if (!Birthdate.equals(other.Birthdate))
			return false;
		if (CountryId == null)
		{
			if (other.CountryId != null)
				return false;
		} else if (!CountryId.equals(other.CountryId))
			return false;
		if (DeviceToken == null)
		{
			if (other.DeviceToken != null)
				return false;
		} else if (!DeviceToken.equals(other.DeviceToken))
			return false;
		if (Email == null)
		{
			if (other.Email != null)
				return false;
		} else if (!Email.equals(other.Email))
			return false;
		if (EmailVerified == null)
		{
			if (other.EmailVerified != null)
				return false;
		} else if (!EmailVerified.equals(other.EmailVerified))
			return false;
		if (Firstname == null)
		{
			if (other.Firstname != null)
				return false;
		} else if (!Firstname.equals(other.Firstname))
			return false;
		if (Gender == null)
		{
			if (other.Gender != null)
				return false;
		} else if (!Gender.equals(other.Gender))
			return false;
		if (LanguageId == null)
		{
			if (other.LanguageId != null)
				return false;
		} else if (!LanguageId.equals(other.LanguageId))
			return false;
		if (Lastname == null)
		{
			if (other.Lastname != null)
				return false;
		} else if (!Lastname.equals(other.Lastname))
			return false;
		if (Nickname == null)
		{
			if (other.Nickname != null)
				return false;
		} else if (!Nickname.equals(other.Nickname))
			return false;
		if (PictureRaw == null)
		{
			if (other.PictureRaw != null)
				return false;
		} else if (!PictureRaw.equals(other.PictureRaw))
			return false;
		if (PictureUrl == null)
		{
			if (other.PictureUrl != null)
				return false;
		} else if (!PictureUrl.equals(other.PictureUrl))
			return false;
		if (Signature == null)
		{
			if (other.Signature != null)
				return false;
		} else if (!Signature.equals(other.Signature))
			return false;
		if (UserId == null)
		{
			if (other.UserId != null)
				return false;
		} else if (!UserId.equals(other.UserId))
			return false;
		return true;
	}







	
	
	

}
